package com.rt.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.rt.common.annotation.Log;
import com.rt.common.core.controller.BaseController;
import com.rt.common.core.domain.AjaxResult;
import com.rt.common.enums.BusinessType;
import com.rt.system.domain.RtDifficultyLogDetail;
import com.rt.system.service.IRtDifficultyLogDetailService;
import com.rt.common.utils.poi.ExcelUtil;
import com.rt.common.core.page.TableDataInfo;

/**
 * 难易度调整日志（明细）Controller
 * 
 * @author Yg
 * @date 2022-04-21
 */
@RestController
@RequestMapping("/system/detail")
public class RtDifficultyLogDetailController extends BaseController
{
    @Autowired
    private IRtDifficultyLogDetailService rtDifficultyLogDetailService;

    /**
     * 查询难易度调整日志（明细）列表
     */
    @PreAuthorize("@ss.hasPermi('system:detail:list')")
    @GetMapping("/list")
    public TableDataInfo list(RtDifficultyLogDetail rtDifficultyLogDetail)
    {
        startPage();
        List<RtDifficultyLogDetail> list = rtDifficultyLogDetailService.selectRtDifficultyLogDetailList(rtDifficultyLogDetail);
        return getDataTable(list);
    }

    /**
     * 导出难易度调整日志（明细）列表
     */
    @PreAuthorize("@ss.hasPermi('system:detail:export')")
    @Log(title = "难易度调整日志（明细）", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(RtDifficultyLogDetail rtDifficultyLogDetail)
    {
        List<RtDifficultyLogDetail> list = rtDifficultyLogDetailService.selectRtDifficultyLogDetailList(rtDifficultyLogDetail);
        ExcelUtil<RtDifficultyLogDetail> util = new ExcelUtil<RtDifficultyLogDetail>(RtDifficultyLogDetail.class);
        return util.exportExcel(list, "难易度调整详情");
    }

    /**
     * 获取难易度调整日志（明细）详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:detail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(rtDifficultyLogDetailService.selectRtDifficultyLogDetailById(id));
    }

    /**
     * 新增难易度调整日志（明细）
     */
    @PreAuthorize("@ss.hasPermi('system:detail:add')")
    @Log(title = "难易度调整日志（明细）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RtDifficultyLogDetail rtDifficultyLogDetail)
    {
        return toAjax(rtDifficultyLogDetailService.insertRtDifficultyLogDetail(rtDifficultyLogDetail));
    }

    /**
     * 修改难易度调整日志（明细）
     */
    @PreAuthorize("@ss.hasPermi('system:detail:edit')")
    @Log(title = "难易度调整日志（明细）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RtDifficultyLogDetail rtDifficultyLogDetail)
    {
        return toAjax(rtDifficultyLogDetailService.updateRtDifficultyLogDetail(rtDifficultyLogDetail));
    }

    /**
     * 删除难易度调整日志（明细）
     */
    @PreAuthorize("@ss.hasPermi('system:detail:remove')")
    @Log(title = "难易度调整日志（明细）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(rtDifficultyLogDetailService.deleteRtDifficultyLogDetailByIds(ids));
    }
}
